package com.hepinghospital.user.ui.activity.graphic.graphicSelect

import android.os.Bundle
import com.hepinghospital.user.R
import com.hepinghospital.user.base.BaseActivity
import com.hepinghospital.user.ui.PayActivity
import com.hepinghospital.user.ui.activity.userinfo.MyFamilyActivity
import com.rest.response.Doctor
import jz.joyoung.robot.util.UIConstants
import kotlinx.android.synthetic.main.activity_graphic_select.*
import kotlinx.android.synthetic.main.include_title.view.*

/**
 * @Description 选择业务类型
 * @Author WuJianFeng
 * @Date 2022/8/18 9:29
 */
class GraphicSelectActivity : BaseActivity(){
    override fun initViews() {
        graphic_select_title.tv_title.text = getString(R.string.string_graphic_select_title)
        graphic_select_online.setOnClickListener {
            startPayActivity()
        }

        graphic_select_follow.setOnClickListener {
            startMyFamilyActivity()
        }
    }
    var doctor: Doctor? = null
    var type: Int = 0
    var checkDetailId: String? = null

    override fun initData() {

        doctor = intent.getSerializableExtra(UIConstants.OBJ_Doctor) as Doctor?
        type = intent.getIntExtra(UIConstants.PayActivity_TYPE_FLAG, UIConstants.PayActivity_TYPE_0)
        checkDetailId = intent.getStringExtra("checkDetailId")

    }

    override fun getLayoutResource(): Int {
        return R.layout.activity_graphic_select
    }


    private fun startPayActivity() {
        val bundle = Bundle()
        bundle.putSerializable(UIConstants.OBJ_Doctor, doctor)
        bundle.putInt(UIConstants.PayActivity_TYPE_FLAG, UIConstants.PayActivity_TYPE_0)
        bundle.putString("checkDetailId", checkDetailId)
        bundle.putInt(UIConstants.GRAPHIC_TYPE_FLAG, UIConstants.GRAPHIC_TYPE_1)
        startActivity(PayActivity::class.java, bundle)
    }

    private fun startMyFamilyActivity(){
        val bundleFamily = Bundle()
        bundleFamily.putSerializable(UIConstants.OBJ_Doctor,doctor)
        bundleFamily.putInt(UIConstants.INTO_MyFamilyActivity_FLAG, UIConstants.INTO_MyFamilyActivity_FLAG_2)
        startActivity(MyFamilyActivity::class.java, bundleFamily)
    }
}